import instance from './index'

// 获取订单趋势数据
export const getOrderTrendData = async (type: 'week' | 'month') => {
    const apiUrl = type === 'week' ? '/api/statistics/last-seven-days' : '/api/statistics/last-thirty-days'
    const response = await instance.get(apiUrl)
    return response.data.orderTimeStatistics
}

// 获取服务类型统计数据
export const getServiceTypeStatistics = async () => {
    const response = await instance.get('/api/statistics/service-types/overall')
    return response.data
}

// 获取客户类型统计数据
export const getCustomerTypeStatistics = async () => {
    const response = await instance.get('/api/statistics/customer-overall')
    return response.data
}

// 获取收入统计数据
export const getIncomeStatistics = async (startDate: string, endDate: string) => {
    const response = await instance.get('/api/statistics/custom', {
        params: { startDate, endDate }
    })
    return response.data.incomeStatistics
}

// 获取今日统计数据
export const getTodayStatistics = async () => {
    const response = await instance.get('/api/statistics/today')
    return response.data
} 